//
//  MCViewController.h
//  MClient
//
//  Created by  崔玉国 on 10-8-23.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "MClientAppDelegate.h"
#import "MCFunction.h"
#import "MCUserDefaults.h"
#import "MCImageObject.h"
#import "MCConfigCache.h"
#import "MServerDAOProtocol.h"

#define kInvalidIdentiferID    -1

@interface UIViewController(MClient)
@property(nonatomic, readonly)UIView *clientView;
//序列化该页面的数据到NSData;
- (NSData*)serialized;
//反序列化页面数据
- (void)deserialized;
@end

@interface MCViewController : UIViewController<MCServer2ViewDelegate> {//最重要的作用，1、代理了接收到返回数据后的处理接口虚函数。2、定义了一些全局对象的引用接口。huotianjun
	int                identiferId;
	bool               bAddHelpBtn;
	UIButton          *helpButton;
	UIView            *bgView;
	NSString*          helpUrl;
	
	UIView*            clientView;
	NSString*          tabBarTitle;
	BOOL               rightNaviButtonAdded;
}

@property(nonatomic, assign)int   identiferId;
@property(nonatomic, assign)bool  addHelpButton;
@property(nonatomic, readonly)MClientAppDelegate     *appDelegate;
@property(nonatomic, readonly)MCUserDefaults         *userDefaults;
@property(nonatomic, readonly)MCImageObject          *imgObject;
@property(nonatomic, readonly)MCConfigCache          *configCache;
@property(nonatomic, retain)NSString          *helpUrl;

@property(nonatomic, readonly)float    width;
@property(nonatomic, readonly)float    height;

@property(nonatomic, assign)UIBarButtonItem*    rightBarButtonItem;
@property(nonatomic, assign)NSString*           rightBarButtonItemTitle;

//{@对NavigationBar上的左右工具条添加的函数以及返回按钮设置
- (void)backBarButton:(NSString*)aTitle;
- (void)rightBarButton:(NSString*)aTitle withStyle:(UIBarButtonItemStyle)style selector:(SEL)sel;
- (void)leftBarButton:(NSString*)aTitle withStyle:(UIBarButtonItemStyle)style selector:(SEL)sel;
//@}
// 弹出消息框
- (void)messageBox:(NSString *)title message:(NSString *)message delegate:(id)delegate 
 cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles;//, ...;

/**
 * Searches the view hierarchy recursively for the first responder, starting with this window.
 */
- (UIView*)findFirstResponder;

/**
 * Searches the view hierarchy recursively for the first responder, starting with topView.
 */
- (UIView*)findFirstResponderInView:(UIView*)topView;

- (void)registerForKeyboardNotifications;
- (void)unregisterForKeyboardNotifications;
- (void)resetSubViewFrame;

- (void)resetBackground;

- (void) setLoginButton; 
@end
